package com.kuang.scanner;

import java.util.Scanner;

public class Demo03 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入整数");
        int i=0;
        float f=0.01f;
        if(scanner.hasNextInt()){
            i = scanner.nextInt();
            System.out.println("整数:"+i);
        }
        System.out.println("不是整数");

        System.out.println("输入小数");
        if(scanner.hasNextFloat()){
            f = scanner.nextFloat();
            System.out.println("小数:"+f);
        }
        System.out.println("不是小数");
        scanner.close();
    }
}
